package com.coder._02.client;

import com.coder._02.sequence.ClientSequenceNum02;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

/**
 * 客户端业务逻辑类
 */
public class TimeClientHandlerPOJO extends ChannelInboundHandlerAdapter {

    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) {
        ClientSequenceNum02.num(TimeClientHandlerPOJO.class);
        // 直接将信息转换成Time类型输出即可
        Time time = (Time) msg;
        System.out.println(time);
        ctx.close();
    }

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
        cause.printStackTrace();
        ctx.close();
    }

}
